package NC29_二维数组中的查找;

public class Solution {
    public boolean Find(int target, int [][] array){
        int rows = array.length;   // 行数
        int lines = array[0].length; // 列数

        for (int i = rows - 1, j = 0; i >= 0 && j < lines;){
            if (array[i][j] > target){
                i--;
            }else if (array[i][j] < target){
                j++;
            }else if (array[i][j] == target){
                return true;
            }
        }
        return false;
    }
}
